<template>
	<view>
		<ViewFilter></ViewFilter>
		<ViewAction></ViewAction>
		<!-- <ViewDetail></ViewDetail> -->
		<ViewGird></ViewGird>
	</view>
</template>

<script>
	import {
		Pagination,Entity,NewEntity
	} from './controller/entity.js'
		import {mapState,mapMutations} from 'vuex'
	import ViewFilter from './view/filter.vue'
	import ViewGird from './view/gird.vue'
	import ViewAction from './view/action.vue'
	import ViewDetail from './view/details.vue'

	export default {
		data() {
			return {
				Pagination: Pagination,
				Entity:Entity
			}
		},computed: {
			...mapState(['hasLogin', 'gotoinfo']),
		},
		components: { //2.注册组件（这步属于传统vue规范，但在uni-app的easycom下可以省略这步） 
			ViewFilter,
			ViewGird,
			ViewAction,
			//ViewDetail
		},
		onReachBottom() { //触底加载分页
			console.log(this.Pagination.Page);
			this.Pagination.Page++;
		},
		methods:{
			//绑定
			...mapMutations(['logout','setGotoInfo']), //方法设置登录
		},
		onLoad() {
			if(!this.hasLogin){
				this.setGotoInfo("/pages/schoollist/index");
				uni.navigateTo({
					url: '../login/login'
				});
			}
			this.Pagination.Page = 1;
			this.Pagination.Ids=[];
			NewEntity();//初始化Entity数据
		},
		provide: {
			Pagination:Pagination
		}
	}
</script>

<style>
</style>
